package alipay

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models/trans/mini/alipay"
	"jlpay-sdk-go/pkg/jlpay/services"
)

// WapPayService 支付宝WAP支付服务
type WapPayService struct {
	*services.BaseService
}

// NewWapPayService 创建支付宝WAP支付服务
func NewWapPayService(config *core.Config) *WapPayService {
	return &WapPayService{
		BaseService: services.NewBaseService(config),
	}
}

// WapPay 支付宝WAP支付
func (s *WapPayService) WapPay(request *alipay.WapPayRequest) (*alipay.WapPayResponse, error) {
	response := alipay.NewWapPayResponse()
	err := s.Post(request, response, "/open/trans/waph5pay")
	if err != nil {
		return nil, err
	}
	return response, nil
}
